<template>
  <div style="padding:20px;" id="app">
    <div class="panel panel-primary">
      <div class="panel-heading">ceshi</div>
      <div class="align-center">
  <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      prop="sourceinfoId"
      label="源数据源id">
    </el-table-column>
    <el-table-column
      prop="sourcedb"
      label="源数据db">
    </el-table-column>
      <el-table-column
        prop="sourcetable"
        label="源数据table">
      </el-table-column>
    <el-table-column
      prop="extractType"
      label="抽取类型">
    </el-table-column>
      <el-table-column
        prop="targetinfoId"
        label="目标数据源id">
      </el-table-column>
    <el-table-column
      prop="targetdb"
      label="目标数据db">
    </el-table-column>
    <el-table-column
      prop="targettable"
      label="目标数据table">
    </el-table-column>
    <el-table-column
      fixed="right"
      align="center"
      label="操作"
      width="150">
      <template slot-scope="scope">
        <el-button @click="accessExcute(scope.row)"  size="small">执行接入</el-button>
      </template>
    </el-table-column>
  </el-table>
</div>
  </div>
  </div>
</template>

<script>
    export default {
      data() {
        return {
          tableData: [{
            dname: '2016-05-02',
            dtype: '王小虎',
            dadress: '上海市普陀区金沙江路 1518 弄'
          }]
        }
      },
      methods: {
        accessExcute(row){
          let id = row.id
          this.$http.post('http://127.0.0.1:8091/dataAccessinfo/importdata',
            {id:id
            }
            ,{emulateJSON: true}).then((response) => {
              debugger
              let re = response.body

            if(re.flag == "success"){

            }else if (re.flag == "fail"){

            }
            alert(re.message);
          });
        }
       },
      created() {
        this.$http.post('http://127.0.0.1:8091/dataAccessinfo/listAllDataAccessinfo',
          {
          }
          ,{emulateJSON: true}).then((response) => {
          // if(response.bodyText = "success"){
          this.tableData = response.body
        });
      }
    }
</script>

<style type="text/css">
  .align-center{
    margin:0 50px;      /* 居中 这个是必须的，，其它的属性非必须 */
    width:1200px;        /* 给个宽度 顶到浏览器的两边就看不出居中效果了 */
    background:white;     /* 背景色 */
    text-align:center;  /* 文字等内容居中 */
  }
</style>
